package com.haoze.nurseapp.controller;

import com.haoze.common.response.Result;
import com.haoze.nurseapp.dto.NurseOrdersReviewDTO;
import com.haoze.nurseapp.model.WardLogMenuEntity;
import com.haoze.nurseapp.service.MealListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 膳食单
 * @author lufq
 * @date 2020/11/12
 */
@RestController
@Api(value = "膳食单")
@RequestMapping("/nurseapp/diet")
public class MealListController {
    @Autowired
    private MealListService mealListService;
    /**
     * 膳食单
     * @param pageNum
     * @param pageSize
     * @param wardId
     * @return
     */
    @GetMapping("/query")
    @ApiOperation(value = "膳食单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页长", required = true),
            @ApiImplicitParam(name = "wardId", value = "病区", required = true)
    })
    public Result query(@RequestParam int pageNum,@RequestParam int pageSize,
                        @RequestParam String wardId) {
        return mealListService.query(pageNum,pageSize,wardId);
    }


    @GetMapping("/wardLogMenu")
    @ApiOperation(value = "病区日志下拉框")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页长", required = true),
            @ApiImplicitParam(name = "wardId", value = "病区id", required = true),
            @ApiImplicitParam(name = "search", value = "查询条件", required = false),
    })
    public Result wardLogMenu(@RequestParam int pageNum,@RequestParam int pageSize,
                              @RequestParam String wardId,@RequestParam(required = false) String search) {
        return mealListService.wardLogMenu(pageNum,pageSize,wardId,search);
    }


    @GetMapping("/getInpatNumByMenu")
    @ApiOperation(value = "根据医嘱类别显示相应的医嘱内容")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wardId", value = "病区id", required = true),
            @ApiImplicitParam(name = "orderItemIds", value = "医嘱类型", required = false)
    })
    public Result wardLogMenu(@RequestParam String wardId,@RequestParam(required = false) String orderItemIds) {
        return mealListService.getInpatNumByMenu(wardId,orderItemIds);
    }

    @PostMapping("/insertWardLogMenu")
    @ApiOperation(value = "保存项目")
    public Result insertWardLogMenu(@RequestBody List<WardLogMenuEntity> wardLogMenuEntityList) {
        return mealListService.insertWardLogMenu(wardLogMenuEntityList);
    }


    @GetMapping("/getWardLogMenuByNuserId")
    public Result getWardLogMenuByNuserId(@RequestParam String wardId) {
        return mealListService.getWardLogMenuByNuserId(wardId);
    }
}
